// packageActivity/pages/advance-payment-info/advance-payment-info.js
import user from "../../../utils/user"
import { toast } from "../../../utils/util"
import { signUpAdvancePayment } from "../../api/activity"
Page({
    data: {
        companyName:'',
        userName:'',
        phone:''
    },
    async onLoad(options) {
        await user.waitLogin()
        console.log(user, 'user')
        this.setData({
            userName:user.userName,
            companyName:user.companyName,
            phone:user.phoneNum
        })
        // userName
    },


    onShow() {

    },

    async onSubmit(){
        if(!this.data.companyName){
            toast('请填写公司名称')
            return
        }
        if(!this.data.userName){
            toast('请填写姓名')
            return
        }
        if(!this.data.phone){
            toast('请填写手机号')
            return
        }
        await signUpAdvancePayment({
            companyName: this.data.companyName,
            phone: this.data.phone,
            userName: this.data.userName,
            type: 4
        })
        wx.navigateTo({
          url: '/packageActivity/pages/advance-payment-success/advance-payment-success',
        })
    }
})